// pages/mysave/mysave.js
const util = require("../../utils/util.js");
const app = getApp()
const baseImgUrl = util.baseImgUrl;
const jumpurl = util.jumpurl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    scanPic:baseImgUrl+"scan_home.png",
    newestlist: [
      {
      id: 0,
      picurl: baseImgUrl + "book_ceshi1.png",
      bookname: "小凤仙故事-小知识大世界小知识大世界小凤仙故事-小知识大世界小知识大世界",
      author: "银河老师银河老师银河老师",
      scan: "123600",
      hasread: 0
    }, {
      id: 1,
      picurl: baseImgUrl + "book_ceshi1.png",
      bookname: "小凤仙故事-小知识大世界",
      author: "银河老师",
      scan: "1236",
      hasread: 0
    }, {
      id: 2,
      picurl: baseImgUrl + "book_ceshi1.png",
      bookname: "小凤仙故事-小知识大世界",
      author: "银河老师",
      scan: "12360",
      hasread: 0
    },{
      id: 5,
      picurl: baseImgUrl + "book_ceshi1.png",
      bookname: "添加的数据1",
      author: "银河老师银河老师银河老师",
      scan: "1236",
      hasread: 0
    }, {
      id: 6,
      picurl: baseImgUrl + "book_ceshi1.png",
      bookname: "添加的数据2",
      author: "银河老师",
      scan: "1236",
      hasread: 0
    }, {
      id: 7,
      picurl: baseImgUrl + "book_ceshi1.png",
      bookname: "添加的数据3",
      author: "银河老师",
      scan: "1236",
      hasread: 0
    }
    ],
    noneUrl:baseImgUrl+"nonepic.png",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.request({
      url: jumpurl + 'my/my_shoucang',
      data: {
        openid: app.globalData.openid,
      },
      method: "POST",
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      success: function (res) {
        that.setData({
          newestlist: res.data.newestlist,
        })
      },
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
      //请求接口获取数据

      var i;
      for(i=0;i<3;i++){
        util.loading();
      }
      if(i==3){
        wx.showToast({
          title: '没有更多的数据',
          icon:"none"
        })
      }
      

     
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})